unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  sText,sTmp,sPass,sUser : string;
  i,iPos,iLen,iASC,iPKey : Integer;
begin
  sText := Edit1.Text;
  sUser := '006';
  iPKey := Ord(sUser[1]);
  iLen := Length(sUser)-1;
  iPos :=1;
  while iLen>0 do
  begin
    Inc(iPos);
    iPKey := iPKey + Ord(sUser[iPos]);
    Dec(iLen);
  end;  

  iLen := Length(sText);
  iPos :=1;
  while iLen>0 do
  begin
    iASC := Ord(sText[iPos]);
    sTmp := Char((iASC+iPKey) * iPos mod 128);
    sPass := sPass + sTmp;
    Dec(iLen);
    Inc(iPos);
  end;

  ShowMessage(sPass);

end;

end.
